use comb, clear

/* define "can use" as weighted average of two survey questions, normalised to [0,1] */
gen canUseRule = (ableAllocateRule + understoodRule) / 200
gen canUseCBC = (ableAllocateCBC + understoodCBC) / 200
label var canUseRule "Can use rule interface effectively (self reported)"
label var canUseCBC "Can use case-by-case interface effectively (self reported)"

qui {

	gen rboECUs = part1RuleRBO == 1
	
	label var daFirst "Case-by-case in problems 1-10"
	label var flagd "Part 1 case-by-case choices violate GARP"
	label var AfriatDrop "Drop in Afriat CCEI when adding rule allocations"
	label var rboECUs "Rule: equal number of ECUs (rather than shares)"
	label var gender "Male"
	label var age "Age"
	
	probit daOrRule numCompanies daFirst diffRule mturkStakes sample
	eststo column1
	
	probit daOrRule numCompanies diffRule daFirst  mturkStakes sample flagd AfriatDrop oneCompanyRule1 rboECUs part1RuleBaseline
	eststo column2
	
	probit daOrRule numCompanies diffRule daFirst mturkStakes sample flagd AfriatDrop oneCompanyRule1 rboECUs part1RuleBaseline age gender canUseCBC canUseRule timeInDaTask timeInSurvey
	eststo column3

}

/* Stata output */
esttab column1 column2 column3, b(%9.2f) pr2 star(* 0.10 ** 0.05 *** 0.01) nocons nodep label se collabels(none) eqlabels(none) obslast stats(N r2_p, fmt(0 3) labels(`"Observations"' `"Pseudo R^2"'))

/* Latex output (to be included inside a Latex table) */
esttab column1 column2 column3 using table2.tex, b(%9.2f) booktabs nocons nonumbers nodep width(\textwidth) star(* 0.10 ** 0.05 *** 0.01) alignment(d{-2}) nomtitles fragment collabels(none) label se eqlabels(none) obslast pr2 replace stats(N r2_p, fmt(0 3) layout("\multicolumn{1}{c}{@}" "\multicolumn{1}{S}{@}") labels(`"Observations"' `"Pseudo \(R^{2}\)"'))
